Skip to content

Conversation

alexfinger21
Copy link
Contributor

Fixed issue #3077
The problem was that nvim-tree did not check if the file was a symlink, and the method vim.loop.fs_stat(cwd) returns the filetype of the file that the symlink points to, not the type of file the symlink is. I simply added a check vim.loop.fs_lstat(new_cwd), which returns an object with type == "link" if the file is a symlink.

@alex-courtis alex-courtis changed the title fix(#3077) deleting a directory containing symlink file will delete content that symlink points to fix(#3077): deleting a directory containing symlink file will delete content that symlink points to Jul 27, 2025
@alex-courtis alex-courtis changed the title fix(#3077): deleting a directory containing symlink file will delete content that symlink points to fix(#3077): deleting a directory containing symlinked directory will delete the contents of the linked directory Jul 27, 2025
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested OK, also via sshfs

ln -sv $(pwd)/mnt $(pwd)/first-dir/mnt-symlink

Many thanks for your contribution!

@alex-courtis alex-courtis merged commit 10db694 into nvim-tree:master Jul 27, 2025
4 checks passed
@alexfinger21
Copy link
Contributor Author

No problem! This is my first public contribution)

@alex-courtis
Copy link
Member

No problem! This is my first public contribution)

Congrats! Big milestone...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants